<%@page contentType="text/html;charset=utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>当当图书 – 全球最大的中文网上书店</title>
		<link href="../css/book.css" rel="stylesheet" type="text/css" />
		<link href="../css/second.css" rel="stylesheet" type="text/css" />
		<link href="../css/secBook_Show.css" rel="stylesheet" type="text/css" />
		<link href="../css/list.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="../js/prototype-1.6.0.3.js"></script>
		<link rel="stylesheet" href="../css/gwap.css" type="text/css" />
	</head>
	<body>

		<div style="width: 962px; margin: auto;">
			<%@include file="../common/head3.jsp"%>
			<a href="../main/index.action"><img
					src="../images/default/book_banner_081203.jpg" border="0" /> </a>
		</div>
		<div class='your_position'>
			您现在的位置:&nbsp;
			<a href='../main/index.action'>当当图书</a> &gt;&gt;
			<font style='color: #cc3300'><strong>小说</strong> </font>
		</div>

		<div class="book">

			<!--左栏开始-->
			<div id="left" class="book_left">
				<div id="__fenleiliulan">
					<div class=second_l_border2>
						<h2>
							分类浏览
						</h2>
						<ul>
							<li>
								<div>
									<div class=second_fenlei>
										&middot;
									</div>
									<!-- 二级分类开始,	如果三级分类没有 -->
									<s:if test="cThree eq null">
										<div class=second_fenlei3>
											全部.........
										</div>
									</s:if>
									<s:else>
										<div class=second_fenlei>
											<a href="book_list.action?cTwo=<s:property value="cTwo"/>">全部</a>
										</div>
									</s:else>
									<!-- 二级分类结束 -->
								</div>
							</li>
							<div class=clear></div>


							<!--三级分类开始-->

							<s:iterator value="catList">
								<li>
									<div>
										<div class=second_fenlei>
											&middot;
										</div>
										<s:if test="id eq cThree">
											<div class=second_fenlei3>
												<s:property value="name" />
												&nbsp;(
												<s:property value="productNum" />
												)
											</div>
										</s:if>
										<s:else>
											<div class=second_fenlei>
												<a
													href="book_list.action?cTwo=<s:property value="parentId"/>&cThree=<s:property value="id"/> ">
													<s:property value="name" />&nbsp;(<s:property
														value="productNum" />) </a>
											</div>
										</s:else>
									</div>
								</li>
								<div class=clear></div>
							</s:iterator>
							<!--三级分类结束-->
						</ul>
					</div>
				</div>
			</div>

			<!--左栏结束-->
			<!-- ******************************************************************* -->
			<!--中栏开始-->
			<div class="book_center">

				<!--图书列表开始-->
				<div id="divRight" class="list_right">
					<!-- 排序条件开始 -->
					<div id="book_list" class="list_r_title">
						<div class="list_r_title_text">
							排序方式
						</div>
						<!-- 这里的cThree 实际上是当前页面所拥有的值 ,
										selected="selected" 意思是:选中当前的值-->

						<select name="order"
							onchange="location='book_list.action?cTwo=${cTwo}&cThree=${cThree}&order='+this.value">
							<c:forEach items="${orderOptions}" var="op">
								<c:choose>
									<c:when test="${order eq op.key}">
										<option value="${op.key}" selected="selected">
											${op.value}
										</option>
									</c:when>
									<c:otherwise>
										<option value="${op.key}">
											${op.value}
										</option>
									</c:otherwise>
								</c:choose>
							</c:forEach>
						</select>
						<!-- 排序条件结束 -->

						<div id="divTopPageNavi" class="list_r_title_text3">

							<!--分页导航开始-->
							<s:if test="page gt 1">
								<div class='list_r_title_text3a'>
									<a name=link_page_next
										href='book_list.action?cTwo=<s:property value="cTwo"/>&cThree=<s:property value="cThree"/>&page=<s:property value="page-1"/>&order=<s:property value="order" />
										'>
										<img src='../images/page_up.gif' /> </a>
								</div>
							</s:if>
							<s:else>
								<div class='list_r_title_text3a'>
									<img src='../images/page_up_gray.gif' />
								</div>
							</s:else>


							<div class='list_r_title_text3b'>
								第
								<s:property value="page" />
								页|共
								<s:property value="totalPage" />
								页
							</div>

							<s:if test="page lt totalPage">
								<div class='list_r_title_text3a'>
									<a name=link_page_next
										href='book_list.action?cTwo=<s:property value="cTwo"/>&cThree=<s:property value="cThree"/>&page=<s:property value="page+1"/>&order=<s:property value="order"/>'>
										<img src='../images/page_down.gif' /> </a>
								</div>
							</s:if>
							<s:else>
								<div class='list_r_title_text3a'>
									<img src='../images/page_down_gray.gif' />
								</div>
							</s:else>
							<!--分页导航结束-->
						</div>
					</div>

					<s:iterator value="bookList">
						<!--商品条目开始-->
						<div class="list_r_line"></div>
						<div class="clear"></div>

						<div class="list_r_list">
							<span class="list_r_list_book"><a name="link_prd_img"
								href='book_detail.action?productId=<s:property value="id" />'
								target="_blank"><img
										src="../product/<s:property value="productPic"/>" /> </a> </span>
							<h2>
								<a name="link_prd_name" href='#' target="_blank"> <s:property
										value="productName" /> </a>
							</h2>
							<h3>
								顾客评分：100
							</h3>
							<h4 class="list_r_list_h4">
								作 者:
								<a target='_blank' href='#' name='作者'><s:property
										value="author" /> </a>
							</h4>
							<h4>
								出版社：
								<a target='_blank' href='#' name='出版社'><s:property
										value="publisher" /> </a>
							</h4>
							<h4>
								出版时间：
								<s:property value="publishDate" />
							</h4>
							<h5>
								<s:property value="catalogue" />
							</h5>
							<div class="clear"></div>
							<h6>
								<span class="del">￥<s:property value="fixedPrice" /> </span>
								<span class="red">￥<s:property value="dangPrice" /> </span>
								节省：￥
								<s:property value="fixedPrice - dangPrice" />
							</h6>
							<!-- 购买开始 -->
							<span class="list_r_list_button"> 
								<s:if test="#session[@com.dangdang.util.Constants@USER_KEY] != null">
									<a href="javascript:;"
										onclick="additem(<s:property value="id"/>);"> <img
											src='../images/buttom_goumai.gif' /> </a>
								</s:if> 
								<s:else>
									<a
										href="../cart/additem.action?productId=<s:property value="id" />&showcart=true">
										<img src='../images/buttom_goumai.gif' /> </a>
								</s:else> </span>
							<span id='cartinfo_<s:property value="id" />'></span>
							<!-- 购买结束 -->
						</div>

					</s:iterator>
					<!--商品条目结束-->

				</div>
				<!--图书列表结束-->

			</div>
			<!--中栏结束-->

			<script type="text/javascript">
			//传一个产品ID过来
			function additem(productId) {
			new Ajax.Request('../cart/additem.action?productId='+productId,{method:'get',onSuccess:function(req) {
				var st = req.responseText.evalJSON().status;
					//静态类的静态属性地址
				if(st==<s:property value="@com.dangdang.util.Constants@CART_STATUS_OK"/>) {
					//Proto
					$('cartinfo_'+productId).style.color='green';
					$('cartinfo_'+productId).innerHTML = "成功购买";
				} else if(st==<s:property value="@com.dangdang.util.Constants@CART_STATUS_EXIST"/>){
					$('cartinfo_'+productId).style.color='red';
					$('cartinfo_'+productId).innerHTML = "已经在购物车";
				}
				window.setTimeout(function(){$('cartinfo_'+productId).innerHTML=""},3000)
			}})
			}
			</script>
			<!--页尾开始 -->
			<%@include file="../common/foot.jsp"%>
			<!--页尾结束 -->
	</body>

</html>
